<!DOCTYPE html>
<html>
	<head>
		<title>菜单预览</title>
		<meta charset="utf-8">
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<!-- 所有的 css & js 资源 -->
		<link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
		<link rel="stylesheet" href="../../static/sa.css">
		<script src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
		<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>

		<script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
		<script src="https://unpkg.com/jquery@3.4.1/dist/jquery.min.js"></script>
		<script src="https://www.layuicdn.com/layer-v3.1.1/layer.js"></script>
		
		<script src="../../static/sa.js"></script>
		<script src="../../sa-resources/config.js"></script>

		<style>
			body,
			.el-tree {
				background-color: #eee;
			}

			.el-tree-node {
				margin: 0.15em 0 !important;
			}

			/* 悬浮时颜色更深一点 */
			.el-tree-node__content:hover {
				background-color: #CFE8FC !important;
			}
		</style>
	</head>
	<body>
		<div class="vue-box" style="display: none;" :style="'display: block;'">
			<!-- 表格 -->
			<div style="padding: 0 1em;">
				<div class="c-title">菜单预览</div>

				<!-- 树插件 -->
				<el-tree ref="tree" :data="dataList" node-key="id" :default-expand-all="true">
					<span class="custom-tree-node" slot-scope="s">
						<span style="color: #2D8CF0;"
							v-if="s.data.status == true">{{ s.data.name }}</span>
						<span style="color: #999;" v-if="s.data.status == false">{{ s.data.name }} (隐藏)</span>
						<span style="color: #999;" v-if="s.data.remark">&emsp;———— {{s.data.remark}} </span>
					</span>
				</el-tree>

				<br><br><br>
			</div>
		</div>

		<script src="../../sa-resources/menu-list.js"></script>
		<script src="../../sa-resources/index/admin-util.js"></script>

		<script src="../../sa-resources/api.js"></script>
		<script src="../../sa-resources/wuyan.js"></script>
		<script src="../../sa-resources/element-ui-helper.js"></script>

		<script>
			var app = new Vue({
				el: '.vue-box',
				data: {
					dataList: [], // 数据集合 
				},
				created: function() {
					axiosConfig(axios)

					let loading = elLoadding({
						that: this
					})

					// 功能列表
					let url = getUrl('pub-function', 'list')
					let http = getHttp(axios, 'pub-function', 'list')
					let queryParams = []
					http(url, {
							params: {
								isPage: false,
								params: JSON.stringify(queryParams)
							}
						}).then(res => {
							this.dataList = res.list ? res.list : []; // 数据
							this.dataList = listToMenu(this.dataList)

							loading.close()
						})
						.catch((err) => {
							sa.error(err.msg)
							loading.close()
						});
				}
			})
		</script>
	</body>
</html>
